package win32;

import com.sun.jna.Pointer;
import com.sun.jna.platform.win32.User32;
import com.sun.jna.platform.win32.WinDef;
import com.sun.jna.platform.win32.WinUser;

public class User32Api {

    static User32 user32 = User32.INSTANCE;

    /**
     * 关闭指定句柄对应的窗口
     * @param hwnd 窗口句柄
     */
    public static void closeWindowByHwnd(long hwnd) {
        user32.SendMessage(new WinDef.HWND(new Pointer(hwnd)), WinUser.WM_CLOSE,new WinDef.WPARAM(0),new WinDef.LPARAM(0));
    }


}
